<html>
<head><meta charset="utf-8"><title>Support for user indentation setting? · t-compiler/rust-analyzer · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/index.html">t-compiler/rust-analyzer</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Support.20for.20user.20indentation.20setting.3F.html">Support for user indentation setting?</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="244958136"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Support%20for%20user%20indentation%20setting%3F/near/244958136" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Support.20for.20user.20indentation.20setting.3F.html#244958136">(Jul 05 2021 at 17:11)</a>:</h4>
<p><span class="user-mention silent" data-user-id="300586">Lukas Wirth</span> <a href="#narrow/stream/185405-t-compiler.2Frust-analyzer/topic/Remove.20.60Replace.20unwrap.20with.20match.60.20assist/near/244925987">said</a>:</p>
<blockquote>
<p>I'm also not sure why the match gets indented that weirdly but I think thats just our reindentation logic not working well enough for matches. We really are in dire need of a formatter <span aria-label="big smile" class="emoji emoji-1f604" role="img" title="big smile">:big_smile:</span></p>
</blockquote>
<p>Speaking of indentation, one recurring issue I have had with RA code insertions (the ones I use most often are the code actions to fill the arms of a match and to add missing members of an <code>impl Trait for Type</code>) is that it always uses 4 space indentation, even though I use 2 space indentation everywhere. I know I'm bucking the trend here so I tolerate it, but it would be nice if there were a setting I could use to fix this permanently, or even better if it just automagically figured things out by looking at my vscode tab stop settings, rustfmt settings (which I don't use, but I keep anyway for the sake of external contributors) or the code.</p>



<a name="245051493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Support%20for%20user%20indentation%20setting%3F/near/245051493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Support.20for.20user.20indentation.20setting.3F.html#245051493">(Jul 06 2021 at 15:03)</a>:</h4>
<p>There is LSP support for this (<a href="https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#insertTextMode">https://microsoft.github.io/language-server-protocol/specifications/specification-3-17/#insertTextMode</a>) as an example. We probably do not honor it in the server.</p>



<a name="245051905"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Support%20for%20user%20indentation%20setting%3F/near/245051905" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Jeremy Kolb <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Support.20for.20user.20indentation.20setting.3F.html#245051905">(Jul 06 2021 at 15:06)</a>:</h4>
<p>Filed 9510</p>



<a name="245091194"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Support%20for%20user%20indentation%20setting%3F/near/245091194" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Mario Carneiro <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Support.20for.20user.20indentation.20setting.3F.html#245091194">(Jul 06 2021 at 19:59)</a>:</h4>
<p><span class="user-mention" data-user-id="203366">@Jeremy Kolb</span> That setting appears to be about adjusting the indentation of all lines uniformly to match the start point, which matches what vscode will do by default if you copy a block of code from one point to another at another indentation level. It doesn't change the relative indentation between two lines in the snippet: if you copy a 4-space indented block of code into a 2-space indentation file, the indents will still be 4 spaces.</p>



<a name="245092572"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/185405-t-compiler/rust-analyzer/topic/Support%20for%20user%20indentation%20setting%3F/near/245092572" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Florian Diebold <a href="https://rust-lang.github.io/zulip_archive/stream/185405-t-compiler/rust-analyzer/topic/Support.20for.20user.20indentation.20setting.3F.html#245092572">(Jul 06 2021 at 20:11)</a>:</h4>
<p>see <a href="https://github.com/rust-analyzer/rust-analyzer/issues/1191">https://github.com/rust-analyzer/rust-analyzer/issues/1191</a></p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>